﻿@using OPM
@using OPM.MultiResource;
@model OPM.Models.GetCase 

<div id="servicePage2" class="servicePage dNone">
    <table>
        <tr>
            <td>@Multi.contact</td>
            <td>
                <input type="text" name="name-input" id="contact" value="" />
                <input type="hidden" name="name-id" id="contact-id" value="" />
                <a href="@Url.Action("LovSearchContact", "Complaint")?a=contact" 
                   data-block="block_contact" class="callBoxContact">
                   &nbsp; <div class="search-person"></div>
                 <span id="block_contact"></span>
                    <input type="hidden" name="cont_contact_detail" id="cont_contact_detail" />
                    <input type="hidden" name="cont_is_secret" id="cont_is_secret" />
                    <input type="hidden" name="cont_type" id="cont_type" />
                    <input type="hidden" name="cont_country_id" id="cont_country_id" />
                    <input type="hidden" name="cont_gender_id" id="cont_gender_id" />
                    <input type="hidden" name="cont_title" id="cont_title" />
                    <input type="hidden" name="cont_firstname" id="cont_firstname" />
                    <input type="hidden" name="cont_lastname" id="cont_lastname" />
                    <input type="hidden" name="cont_citizen_id" id="cont_citizen_id" />
                    <input type="hidden" name="cont_address" id="cont_address" />
                    <input type="hidden" name="cont_province_id" id="cont_province_id" />
                    <input type="hidden" name="cont_district_id" id="cont_district_id" />
                    <input type="hidden" name="cont_subdistrict_id" id="cont_subdistrict_id" />
                    <input type="hidden" name="cont_is_defective" id="cont_is_defective" />
                    <input type="hidden" name="cont_postcode" id="cont_postcode" />
                    <input type="hidden" name="cont_remark" id="cont_remark" />
                    <input type="hidden" name="cont_number" id="cont_number" />
                    <input type="hidden" name="cont_birthday" id="cont_birthday" />
                </a>
            </td>
        </tr>
        <tr>
            <td>@Multi.contactHidden</td>
            <td>
                <input type="checkbox" name="hidden-name-input" id="contactHidden" value="" />
            </td>
        </tr>
        <tr>
            <td>@Multi.is_secret</td>
            <td>
                <select name="secret-level" id="cont_is_secrets">
                    <option value="F">เปิดเผย</option>
                    <option value="T">ปกปิด</option>
                </select>
            </td>
        </tr>
         <tr>
            <td>@Multi.TobeCustomer</td>
            <td>
                <input type="checkbox" name="hidden-name-input" id="tobecustomer"/>
            </td>
        </tr>
    </table>
    <div class="boxBlank"></div>
    <div>
        <div class="BoxServiceActionPrev floatL" onclick="nextStep(1);">@Multi.BackPage</div>
        <div class="BoxServiceActionNext floatR" onclick="nextpage2();">@Multi.NextPage</div>
        <div class="clear"></div>
    </div>
</div>

<script type="text/javascript">

    $(document).ready(function () {
        $(".callBoxContact").colorbox({
            iframe: true,
            width: "650px",
            fastIframe: false,
            height: "80%"
        });
    });

    $("#contactHidden").on('change', function (e) {
        var contacNoName = $('#contactHidden').is(':checked');

        if (contacNoName == true) {

            $("#contact").prop('disabled', true);
            $("#cont_is_secrets").prop('disabled', true);
            $("#tobecustomer").prop('disabled', true);
        }
        else {
            $("#contact").prop('disabled', false);
            $("#cont_is_secrets").prop('disabled', false);
            $("#tobecustomer").prop('disabled', false);
        }

    });


    function nextpage2() {

        var contact = $("#contact").val();
        var tobecustomer = $('#tobecustomer').is(':checked');

        if ((contact != "" || contact != undefined) && tobecustomer == true) {
            nextStep(4);
        }
        else {
            nextStep(3);
        }
    }


    function contactDataReturn(name, id) {
        $.colorbox.close();

        $('#contact').val(name);
        $('#contact-id').val(id);
    }

</script>
